This new release of radio.py
brings more predefined stations and the much wanted recording feature. radio.py
is a python wrapper for mplayer, designed to provide an easy-to-use interface for listening to radio from the command line. And indeed using radio.py is very easy, just pass the station name.
radio.py Classic FM
To read more about radio.py and the existing features go to radio.py – a Wrapper Script for Listening to Radio in Linux.
New stations in this release include Ram FM, Classic FM, Radio Caroline and update to all the radioIO stations. So overall this version of radio.py comes with 81 predefined stations. To see the full list of recognized station run radio.py --list
. If your favorite station is still missing you can add via configuration files, ans described in here. If you will send a comment with the name of the stations and its website, I’ll add it to the next release.
The other important new feature is the ability to record radio streams to mp3 directly from radio.py
. This is done using the --radio
command-line switch. For example the following
radio.py CNN --record cnn.mp3
will record the radio stream of CNN to a file called cnn.mp3
. To stop recording just press ‘q’. This option also be used with the --sleep
and --wake-up
to time your recordings. For example if you want to record a show that start in 30 minutes and is 60 minutes long you should do
radio.py BBC1 --record bbc1.mp3 --wake-up 30 --sleep 60
You can download the new version from here. Installation is pretty straight forward, just untar the archive and put the radio.py
some where in your path (e.g. /usr/local/bin/
) and the package is installed.
As always if you want new stations added to the next release, send a comment with the station details (at least name and website).
UPDATE 14/12/2008: I’ve changed the download link to point to radio.py
‘s SourceForge project page.
The download link doesn’t work!
Hi,
I didn’t see your comment when you posted it, sorry. I fixed the link, thanks for reporting.
Cool!
For anyone interested I have a .radiopy-file with some (58) swedish radio stations here: http://henrikan.wordpress.com/2008/08/02/spela-och-spela-in-internetradio-fran-terminalen/
Very impressive .radiopy file. It’s nice to see people use and share those.
thanks!
Thanks very much, now I can listen radio while working on my Linux workstation.
גיא,
משום מה גלצ לא עובד
יש לך רעיון למה?
רוני
@Roni: I’ve posted an patch for radio.py 0.5 in http://www.guyrutenberg.com/2008/11/12/radiopy-station-list-patch/ that fixes the urls of Galgalatz, Galatz and Radius. Apply the patch and it should fix the problem. Please comment if you encounter further problems.
Guy,
First I must say that your code is wonderfully clear.
Your patch is working well, but some time it fails:
(output)
========
./radio.py Galatz
MPlayer dev-SVN-r26936-4.3.0 (C) 2000-2008 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz (Family: 6, Model: 15, Stepping: 11)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing .
File not found: ”
Failed to open .
Playing mms://213.8.138.13/glz-stream.
STREAM_ASF, URL: mms://213.8.138.13/glz-stream
Connecting to server 213.8.138.13[213.8.138.13]: 1755…
Connected
read error:: Operation now in progress
pre-header read failed
Connecting to server 213.8.138.13[213.8.138.13]: 80…
Connecting to server 213.8.138.13[213.8.138.13]: 80…
Server returned 500:Internal Server Error
Failed to parse header.
Failed, exiting.
Connecting to server 213.8.138.13[213.8.138.13]: 80…
Cache size set to 128 KBytes
Cache fill: 0.09% (116 bytes)
Exiting… (End of file)
@Roni: Take a look at the 7th line from the bottom
>Server returned 500:Internal Server Error
It seems that the Galatz server has some errors occasionally, so it doesn’t seem to be a radio.py bug.
I’ll see if it’s possible to make radio.py retry playing a station if there is some error.
Hello,
I am having an error on Ubuntu 10.04.
It is like this:
sacimud@sacimud-desktop:~$ radio.py BBC3
Traceback (most recent call last):
File “/usr/local/bin/radio.py”, line 253, in
sys.exit(main(options, args))
File “/usr/local/bin/radio.py”, line 212, in main
os.execvp(execargs[0],execargs)
File “/usr/lib/python2.6/os.py”, line 344, in execvp
_execvpe(file, args)
File “/usr/lib/python2.6/os.py”, line 380, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
It seems that you simply don’t have mplayer installed. Install mplayer and see if the error persists.
Normally I do not post on blogs, nonetheless I’d like to state that this post seriously forced me to take action! really nice post.
Hi when i tried to play any station from it’s predefined station then it shows me following error..
root@xxxxxxx~/Desktop# ./radio.py radioIO 70s Rock
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
Resolving streampoint.radioio.com for AF_INET6…
Couldn’t resolve name for AF_INET6: streampoint.radioio.com
Resolving streampoint.radioio.com for AF_INET…
Couldn’t resolve name for AF_INET: streampoint.radioio.com
STREAM_ASF, URL: http://streampoint.radioio.com/streams/6
Resolving streampoint.radioio.com for AF_INET6…
Couldn’t resolve name for AF_INET6: streampoint.radioio.com
Resolving streampoint.radioio.com for AF_INET…
Couldn’t resolve name for AF_INET: streampoint.radioio.com
Failed, exiting.
Resolving streampoint.radioio.com for AF_INET6…
Couldn’t resolve name for AF_INET6: streampoint.radioio.com
Resolving streampoint.radioio.com for AF_INET…
Couldn’t resolve name for AF_INET: streampoint.radioio.com
No stream found to handle url http://streampoint.radioio.com/streams/6
Error while opening playlist file http://streampoint.radioio.com/streams/6: Connection timed out
Error parsing option on the command line: -playlist
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
It looks like you have internet connection problems…